#pragma once

#include "Globals.h"
#include "Messaging.h"

static int IDNUMBER = -1;
class BaseObject
{
public:
	int					m_iID;
	Vector<Message*>	m_Messages;
	eObjectType			m_Type;
	RECT				m_BoundingBox;
	D3DMATERIAL9		m_Material;
	ID3DXMesh*			m_Mesh;
	LPDIRECT3DTEXTURE9	m_pTexture;
	DWORD				m_dwSubset;
	D3DXVECTOR3			m_vPosition;
	sRotation			m_stRotation;
	float				m_fScale;
	bool				m_bActive;

	BaseObject()
		: m_iID(++IDNUMBER)
		, m_Type(NO_TYPE)
		, m_Mesh(NULL)
		, m_pTexture(NULL)
		, m_bActive(true)
		, m_dwSubset(0)
		, m_fScale(1)
	{
		m_stRotation.Set(0,0,0);
		m_vPosition = D3DXVECTOR3(0,0,0);
	}
	virtual void Draw(){m_Mesh->DrawSubset(m_dwSubset);}
	virtual void TranslateMessages() {}
	virtual void GetMessageA(Message* NewMessage){m_Messages.add(NewMessage);}
	virtual void* Update(void*){return 0;}
	void RotateByDegree(float Roll,float Yaw,float Pitch)
	{
		m_stRotation.roll	+= DEGTORAD(Roll);
		m_stRotation.yaw	+= DEGTORAD(Yaw);
		m_stRotation.pitch	+= DEGTORAD(Pitch);
	}
	virtual void SetPosition(D3DXVECTOR3 P){m_vPosition = P;}
};

typedef Vector<BaseObject*> DrawList;